﻿<cfset mapping = event.getModelGlue().configuration.APPLICATIONMAPPING />

<cfoutput>
			<!-- Load TinyMCE -->
			<script type="text/javascript" src="#mapping#/assets/js/tiny_mce/jquery.tinymce.js"></script>
			<script type="text/javascript">
				$().ready(function() {
					$('textarea.textarea').tinymce({
						// Location of TinyMCE script
						script_url : '#mapping#/assets/js/tiny_mce/tiny_mce.js',
			
						// General options
						theme : "advanced",
						plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,advlist",
			
						// Theme options
						theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect",
						theme_advanced_buttons2 : "bullist,numlist,|,outdent,indent,blockquote,|,link,unlink,anchor,image,media,code,|,insertdate,inserttime",
						theme_advanced_toolbar_location : "top",
						theme_advanced_toolbar_align : "left",
						theme_advanced_statusbar_location : "bottom",
						theme_advanced_resizing : true,
						file_browser_callback : "coldFusionFileManager",
			
						// Example content CSS (should be your site CSS)
						content_css : "css/content.css",
			
						// Drop lists for link/image/media/template dialogs
						template_external_list_url : "lists/template_list.js",
						external_link_list_url : "lists/link_list.js",
						external_image_list_url : "lists/image_list.js",
						media_external_list_url : "lists/media_list.js",
	
					});
				});
				$().ready(function() {
					$('textarea.textareasimple').tinymce({
						// Location of TinyMCE script
						script_url : '#mapping#/assets/js/tiny_mce/tiny_mce.js',
			
						// General options
						theme : "simple",
						plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,advlist",
			
					});
				});
				
				function coldFusionFileManager(field_name, url, type, win) {
					var ajaxfilemanagerurl = "#event.linkTo( 'fileManager' )#?editor=tiny";

					var fileBrowserWindow = {
						file:			ajaxfilemanagerurl,
						title:			"ColdFusion File Manager",
						width:			"1020",
						height:			"650",
						resizable:		"yes",
						inline: 		"yes",
						close_previous:	"no"
					};
					
					//Add this to window. Because this is the callback for the Coldfusion FileManager
					window.mmFileManagerCallBack = function( value ){
		
						win.document.forms[0].elements[field_name].value = value;
	
						try {
							tinyMCE.activeEditor.windowManager.close( tinyMCE.activeEditor.windowManager.params.mce_window_id );
						} catch(err) {
							return false;
						}
	
					};
					
					tinyMCE.activeEditor.windowManager.open(fileBrowserWindow, {
						window : win,
						input : field_name
					});
					
					return false;
					
				}
			</script>
			<!-- /TinyMCE -->
</cfoutput>